// pages/zhaoping/zhaoping.js
let animation = wx.createAnimation({
  duration: 4000, //转盘转动时间
  timingFunction: 'ease-out' //动画效果
})
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {

    xueshen: true,
    txtlist: [],
    POST_WORK: '', //岗位
    STUDENT_PHONE: '', //手机号
    POST_SALARY: '', //期望薪资
    POST_NAME: '', //姓名
    modalHidden: true,
    guanggaotanchuang: true,
    shangwang: '',
    xxkuang: true,
    xingbie: true,

    POST_ADD: '',
    xinbiexuan: [{
        xinbie: '大'
      },
      {
        xinbie: '中'
      }, {
        xinbie: '小'
      },
    ],

    POST_IDCARD: '',

    POST_MONEY: '',

    OPEN_ID: '',


    rotate: 0, //度数
    turning: false, //是否点击,
    zhunsj: '', //另一个页面带来的数据
    prize: '', //中奖概率
    count: '', //剩余次数
    prizeList: [
      2100, //一等奖 ...
      2400, //二等奖  ...
      2330, //三等奖...
      2610, //参与奖 ...
      2200, //谢谢惠顾 ...
    ],
    //向1006传递的数据
    USER_PRIZE_ID: '',
    txtlist: '', //翻滚的字幕
    flag: true, //设置节流
    choujiang: true,
    zaicijinru: true,

    wangdian: '',
    POST_SEX: '',
    POST_AGE: '',
    POST_QX: '',
    POST_ADD: '',
    shangwang: '',
    sbwngdian: true,
    wangdiany: true,

    timer: "", // 定时器名字
    countDownNum: '60',
    verify: "",
    EMPLOYEE_ID: '',
    zhongjiangtu: '',
    flag: true, //设置节流
    flagaa: true, //设置节流
    // PRIZE_ID:5,
  },

  chuxian() {

    this.setData({
      xxkuang: false,
    })
  },





  huoqudingwwi() {

    let that = this


    console.log(that.data.jiami);


    wx.getLocation({
      type: 'wgs84',
      success(res) {
        console.log(res)
        const latitude = res.latitude
        const longitude = res.longitude
        const speed = res.speed
        const accuracy = res.accuracy
        console.log(latitude);
        console.log(longitude);
        console.log(speed);
        console.log(accuracy);

        if (res.latitude != '') {
          wx.request({
            url: app.globalData.interface+'/kindergarten/jiarong/API_8005_getAdd',
            method: 'POST',
            data: {
              longitude: res.longitude,
              latitude: res.latitude,

            },
            header: {
              'content-type': 'application/x-www-form-urlencoded'
            },
            success: res => {
              that.setData({
                POST_SEX: res.data.data,
                jindu: longitude,
                weidu: latitude,
              })
            }
          })
        } else {
          console.log(111);
        }
      }
    })



    // if (!this.data.mealsList) {
    //   wx.navigateTo({
    //     url: '../../pages/login/login'
    //   })
    // }

  },






















  guanggao() {


    wx.navigateTo({
      url: '../../pages/shangluozichandabiaoyouhuiquan/shangluozichandabiaoyouhuiquan',
    })
    this.setData({
      guanggaotanchuang: true
    })


  },


  // wangdianshagn() {
  //   this.setData({
  //     sbwngdian: false
  //   })
  // },


  wangdianshagn() {

    if (this.data.POST_ADD == '') {
      wx.showToast({
        title: '请先选择县区！',
        icon: 'none',
        duration: 1500
      })
    } else {

      this.setData({
        sbwngdian: false
      })
    }



  },

  //网点选择
  wangji() {
    this.setData({
      wangdiany: false
    })
  },

  xwang(e) {
    console.log(e);
    console.log(e.currentTarget.dataset.item.wangname);

    this.setData({
      POST_ADD: e.currentTarget.dataset.item.L3name,
      wangdiany: true,
      L3code: e.currentTarget.dataset.item.L3code,
      POST_QX:'',
    })
    this.regionwangdian()
  },

  region() {
    wx.request({
      url: app.globalData.interface+'/ankangdabiao/API_5515_userQueryQuXian',
      method: 'POST',
      data: {
        L2code: 61000127,
        OPEN_ID: this.data.openid,
        session_key: this.data.session_key,
        OPEN_UUID: this.data.jiami,

      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: res => {
        console.log(res.data.data);
        this.setData({
          wangdian: res.data.data,
        })

      }
    })
  },



  regionwangdian() {
    wx.request({
      url: app.globalData.interface+'/ankangdabiao/API_5517_userQueryWangDian',
      method: 'POST',
      data: {
        L3code: this.data.L3code,
        OPEN_ID: this.data.openid,
        session_key: this.data.session_key,
        OPEN_UUID: this.data.jiami,

      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: res => {
        console.log(res.data.data);
        this.setData({
          shangwang: res.data.data,
        })

      }
    })
  },






  wangshang(e) {
    console.log(e);
    console.log(e.currentTarget.dataset.item.L4name);
    console.log(e.currentTarget.dataset.item.EMPLOYEE_ID);

    this.setData({
      POST_QX: e.currentTarget.dataset.item.L4name,
      sbwngdian: true,
      EMPLOYEE_ID: e.currentTarget.dataset.item.EMPLOYEE_ID,


    })
  },

  fetch: function () {
    if (this.data.flag) {
      this.data.flag = false
      if (this.data.STUDENT_PHONE == '') {
        wx.showToast({
          title: '请填写手机号！',
          icon: 'none',
          duration: 3000
        })
      } else if (this.data.session_key == "" || this.data.jiami == "" || this.data.session_key == null || this.data.jiami == null || this.data.session_key == undefined || this.data.jiami == undefined) {
        wx.showModal({
          title: '温馨提示',
          content: '数据错误请返回首页',
          success: function (res) {
            if (res.confirm) { //这里是点击了确定以后   
              console.log('用户点击确定')

              wx.switchTab({
                url: '../../pages/newshouye/newshouye',
              })

            } else { //这里是点击了取消以后
              console.log('用户点击取消')
              wx.switchTab({
                url: '../../pages/newshouye/newshouye',
              })

            }
          }
        })
      } else {
        wx.request({
          url: app.globalData.interface+'/app/API_1052_sendMassage',
          method: 'GET',
          data: {
            phone: this.data.STUDENT_PHONE,
            KEY: 'xianjgjKey9999',
            OPEN_ID: app.globalData.openid, //用户OPEN_ID
            session_key: this.data.session_key,
            OPEN_UUID: this.data.jiami,
            phone_type:'35'
          },
          header: {
            'content-type': 'application/x-www-form-urlencoded'
          },
          success: res => {

            if (res.data.result == 'error') {
              wx.showToast({
                title: res.data.code,
                icon: 'none',
                duration: 3000
              })
            } else {
              wx.showToast({
                title: res.data.code,
                icon: 'none',
                duration: 3000
              })
            }
          }
        })
        var _this = this;
        var countDownNum = _this.data.countDownNum; // 获取倒计时初始值
        var timer = setInterval(function () {
          countDownNum -= 1;
          _this.setData({
            countDownNum: countDownNum
          })
          if (countDownNum <= -1) {
            clearInterval(timer);
            // 取消置顶的setInterval函数将要执行的代码
            _this.setData({
              countDownNum: 60,
            })
          }
        }, 1000)

      }
      setTimeout(() => {
        this.data.flag = true
      }, 5000)

    }
  },



  handleInput(e) {
    let value = this.validateNumber(e.detail.value)

    console.log(value);
    this.setData({
      POST_MONEY: value
    })
  },
  validateNumber(val) {
    return val.replace(/\D/g, '')
  },




  back() {
    wx.navigateBack({
      delta: 1
    })
  },







  xinbie() {
    this.setData({
      xingbie: false
    })
  },


  xin(e) {
    console.log(e);
    console.log(e.currentTarget.dataset.item.xinbie);

    this.setData({
      POST_SEX: e.currentTarget.dataset.item.xinbie,
      xingbie: true,

    })
  },








  // sihuodong() {
  //   wx.request({
  //     url: app.globalData.interface+'/shanyouhui/API_1008_getAllConfig?code=SHANGLUOWORKPOST',
  //     method: 'GET',
  //     data: {
  //       OPEN_ID: this.data.openid, //用户OPEN_ID
  //       session_key: this.data.session_key,
  //       OPEN_UUID: this.data.jiami
  //     },
  //     header: {
  //       'content-type': 'application/x-www-form-urlencoded'
  //     },
  //     success: res => {
  //       console.log(res.data.configList);
  //       this.setData({
  //         txtlist: res.data.configList,

  //       })
  //       console.log(this.data.txtlist);
  //     }
  //   })
  // },



  //验证手机号
  mobileInput(e) {
    let value = e.detail.value.replace(/\D/g, '')
    this.setData({
      mobile: value,
    })
    var myreg = /^(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(16[0-9]{1})|(19[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/;
    if (this.data.mobile.length == 0) {
      wx.showToast({
        title: '输入的手机号为空，请重新输入！',
        icon: 'none',
        duration: 1500
      })
      this.setData({
        mobileFormat: false,
      })
    } else if (this.data.mobile.length < 11) {

      wx.showToast({
        title: '手机号长度有误，请重新输入！',
        icon: 'none',
        duration: 1500
      })
      this.setData({
        POST_PHONE: '',
        mobileFormat: false,
      })

    } else if (!myreg.test(this.data.mobile)) {
      wx.showToast({
        title: '手机号有误，请重新输入！',
        icon: 'none',
        duration: 1500
      })
      this.setData({
        POST_PHONE: '',
        mobileFormat: false,
      })

    } else {
      this.setData({
        mobileFormat: true,
      })
    }
  },




  bouut() {

    if (this.data.flagaa) {

      this.data.flagaa = false




      this.setData({
        openid: app.globalData.openid,
      })

      console.log(this.data.openid);
      if (   this.data.POST_NAME == "" || this.data.STUDENT_PHONE == "" || this.data.openid == "" || this.data.EMPLOYEE_ID == "" || this.data.verify == "") {
        wx.showToast({
          title: '请完善信息',
          icon: 'none',
          duration: 1500
        })
        console.log(this.data.POST_NAME);
        console.log(this.data.STUDENT_PHONE);
        console.log(this.data.openid);
        console.log(this.data.POST_IDCARD);
        console.log(this.data.POST_SEX);
        console.log(this.data.POST_MONEY);

      } else {
        wx.request({
          url: app.globalData.interface+'/baoji/API_8801_postRegistration',
          method: 'POST',
          data: {
            POST_NAME: this.data.POST_NAME,
            POST_PHONE: this.data.STUDENT_PHONE,
            OPEN_ID: this.data.openid, //用户OPEN_ID
            // EMPLOYEE_ID: this.data.EMPLOYEE_ID,
            POST_QX: this.data.POST_ADD,
            POST_ADD: this.data.POST_QX,
            code: this.data.verify,
            // POST_IDCARD: this.data.POST_IDCARD,


            SPRING_FESTIVAL_COUPLETS:'xiao',


            // POST_MONEY: this.data.POST_MONEY,
            session_key: this.data.session_key,
            OPEN_UUID: this.data.jiami,

          },
          header: {
            'content-type': 'application/x-www-form-urlencoded'
          },
          success: res => {
            console.log(res.data.hanZhongPostRegistration);
            console.log(res);
            let choujiangshujuaaaa = JSON.stringify(res.data.hanZhongPostRegistration)


            this.setData({
              choujiangshuju:choujiangshujuaaaa
            })

            let that = this
            if (res.data.result == 'success') {
              wx.showModal({
                title: '温馨提示',
                content: res.data.data,
                success: function (res) {
                  if (res.confirm) { //这里是点击了确定以后   
                    console.log('用户点击确定')

                    // wx.navigateTo({
                    //   // url: '../../pages/weihuyancaolingqu/weihuyancaolingqu?data=' + JSON.stringify(this.data.ressj)
                    //   url: '../../pages/baojichoujiang/baojichoujiang?data=' + JSON.stringify(that.data.STUDENT_PHONE)
          
                    // })


                  } else { //这里是点击了取消以后
                    console.log('用户点击取消')
                    // wx.navigateTo({
                    //   // url: '../../pages/weihuyancaolingqu/weihuyancaolingqu?data=' + JSON.stringify(this.data.ressj)
                    //   url: '../../pages/baojichoujiang/baojichoujiang?data=' + JSON.stringify(that.data.STUDENT_PHONE)
          
                    // })
                  }
                }
              })
            } else {


              wx.showModal({
                title: '温馨提示',
                content: res.data.data,
                success: function (res) {
                  if (res.confirm) { //这里是点击了确定以后   
                    console.log('用户点击确定')
                    console.log('用户点击取消')
                    // wx.navigateTo({
                    //   // url: '../../pages/weihuyancaolingqu/weihuyancaolingqu?data=' + JSON.stringify(this.data.ressj)
                    //   // url: '../../pages/hanzhongwugongchoujiang/hanzhongwugongchoujiang?data=' + encodeURIComponent(that.data.choujiangshuju)
                    //   url: '../../pages/baojichoujiang/baojichoujiang?data=' + encodeURIComponent(that.data.STUDENT_PHONE)
          
                    // })
                  } else { //这里是点击了取消以后
                    console.log('用户点击取消')
                    console.log('用户点击取消')
                    // wx.navigateTo({
                    //   // url: '../../pages/weihuyancaolingqu/weihuyancaolingqu?data=' + JSON.stringify(this.data.ressj)
                    //   url: '../../pages/baojichoujiang/baojichoujiang?data=' + JSON.stringify(that.data.STUDENT_PHONE)
          
                    // })
                  }
                }
              })
            }
          }
        })
      }


      setTimeout(() => {
        this.data.flagaa = true
      }, 3500)


    }


  },


  // shifouchou() {
  //   var that = this
  //   wx.request({
  //     url: app.globalData.interface+'/shangLuoWork/API_1047_postRegistrationTestNumber',
  //     method: 'POST',
  //     //向后端发送的数据
  //     data: {
  //       OPEN_ID: that.data.openid, //将code发送到后台服务器。
  //       session_key: that.data.session_key,
  //       OPEN_UUID: that.data.jiami //将code发送到后台服务器。


  //     },
  //     header: {
  //       "Content-Type": "application/x-www-form-urlencoded" //POST方式是这个
  //     },
  //     success: res => {
  //       console.log(res);
  //       console.log(res.data.flag);
  //       if (res.data.flag == false) {

  //         console.log('不可以抽');

  //       } else {

  //         that.setData({
  //           STUDENT_PHONE: res.data.UserPrizeOpenid.USER_ASSETS_IDCARD,
  //           USER_PRIZE_ID: res.data.UserPrizeOpenid.USER_PRIZE_ID,
  //           choujiang: false,

  //         })



  //       }
  //     }
  //   })
  // },





  // chaxunshifouli() {
  //   wx.request({
  //     url: app.globalData.interface+'/shangLuoWork/API_2011_appointmentRegistrationRaffleSelect',
  //     method: 'POSt',
  //     data: {
  //       OPEN_ID: this.data.openid, //用户OPEN_ID
  //       session_key: this.data.session_key,
  //       OPEN_UUID: this.data.jiami
  //     },
  //     header: {
  //       'content-type': 'application/x-www-form-urlencoded'
  //     },
  //     success: res => {

  //       if (res.data.data.VALID == 2) {
  //         console.log(res.data.appointmentRegistrationPrize.STOCK_ID);
  //         this.setData({
  //           huodeshuju: res.data.data,
  //           zhongjiangtu: res.data.appointmentRegistrationPrize.STOCK_ID,
  //           zaicijinru: false,
  //         })
  //       }
  //     }
  //   })
  // },



  // showPopup() {

  //   this.setData({
  //     modalHidden: true,

  //   });


  //   wx.showModal({
  //     title: '温馨提示',
  //     content: '请前往就近网点激活领取',
  //     success: function (res) {
  //       if (res.confirm) { //这里是点击了确定以后
  //         console.log('用户点击确定')
  //         wx.navigateBack({
  //           delta: 1,
  //         })
  //       } else { //这里是点击了取消以后
  //         console.log('用户点击取消')
  //         wx.navigateBack({
  //           delta: 1,
  //         })
  //       }
  //     }
  //   })

  // },


  linqujiekou() {



    let that =this 


    that.setData({
      mobileFormat: true,
      xxkuang: true,
    })
 
    if (that.data.huodeshuju.PRIZE_ID == '5') {
      // if (this.data.PRIZE_ID == '5') {

        that.setData({
        modalHidden: true,

      });
    } else {

      wx.request({
        url: app.globalData.interface+'/hanzhong/API_7011_postRegistrationRaffleWechat  ',
        method: 'POST',
        data: {

          USER_ASSETS_IDCARD: that.data.STUDENT_PHONE,
          USER_PRIZE_ID: that.data.huodeshuju.USER_PRIZE_ID,
          CUSTOMER_ID: that.data.CUSTOMER_ID,
          OPEN_ID: that.data.openid, //用户OPEN_ID
          session_key: that.data.session_key,
          OPEN_UUID: that.data.jiami
        },
        header: {
          'content-type': 'application/x-www-form-urlencoded'
        },
        success: res => {
          console.log(res);
          wx.showModal({
            title: '温馨提示',
            content: res.data.data,
            success: function (res) {
              if (res.confirm) { //这里是点击了确定以后
                console.log('用户点击确定')
            
              } else { //这里是点击了取消以后
                console.log('用户点击取消')
             
              }
            }
          })
        }
      })

    }
  },




  // linqujiekou() {
  //   wx.request({
  //     url: app.globalData.interface+'/hanzhong/API_7011_postRegistrationRaffleWechat',
  //     method: 'POST',
  //     data: {

  //       USER_ASSETS_IDCARD: this.data.huodeshuju.USER_ASSETS_IDCARD,
  //       USER_PRIZE_ID: this.data.huodeshuju.USER_PRIZE_ID,
  //       CUSTOMER_ID: this.data.CUSTOMER_ID,
  //       OPEN_ID: this.data.openid, //用户OPEN_ID
  //       session_key: this.data.session_key,
  //       OPEN_UUID: this.data.jiami
  //     },
  //     header: {
  //       'content-type': 'application/x-www-form-urlencoded'
  //     },
  //     success: res => {
  //       console.log(res);




  //       wx.showModal({
  //         title: '温馨提示',
  //         content: res.data.data,
  //         success: function (res) {
  //           if (res.confirm) { //这里是点击了确定以后
  //             console.log('用户点击确定')
  //             wx.navigateBack({
  //               delta: 1,
  //             })
  //           } else { //这里是点击了取消以后
  //             console.log('用户点击取消')
  //             wx.navigateBack({
  //               delta: 1,
  //             })
  //           }
  //         }
  //       })
  //     }
  //   })


  // },



  //自定义模态框的取消
  modalCancel: function () {
    let animation = wx.createAnimation({
      duration: 100,
      timingFunction: 'ease-out'
    });
    animation.rotate(0).step();
    this.setData({
      modalHidden: true,
      erdeng: true,
      sandeng: true,
      sideng: true,
      xiexie: true,
      rotate: animation.export(),
    })
    console.log(222);
  },

  //自定义模态框的确定
  queding: function () {
    let animation = wx.createAnimation({
      duration: 100,
      timingFunction: 'ease-out'
    });
    animation.rotate(0).step();
    this.setData({
      modalHidden: true,
      erdeng: true,
      sandeng: true,
      sideng: true,
      xiexie: true,
      rotate: animation.export(),
    })
    console.log(111);
  },


  start: function () {
    let that = this
    // 节流
    if (that.data.flag) {

      that.data.flag = false
      wx.request({
        url: app.globalData.interface+'/hanzhong/API_7005_postRegistrationRaffle',
        method: 'POST',
        data: {
          OPEN_ID: that.data.openid,
          // USER_ASSETS_IDCARD: that.data.phone,
          session_key: this.data.session_key,
          OPEN_UUID: this.data.jiami,
          USER_ASSETS_IDCARD: this.data.STUDENT_PHONE,
        },
        header: {
          'content-type': 'application/x-www-form-urlencoded'
        },
        success: res => {
          if (res.data.result == "error") {
            wx.showModal({
              title: '温馨提示',
              content: res.data.data,
              success: function (res) {
                if (res.confirm) { //这里是点击了确定以后
                  console.log('用户点击确定')

                } else { //这里是点击了取消以后
                  console.log('用户点击取消')

                }
              }
            })
          } else {


            console.log(res.data);
            that.setData({
              huodeshuju: res.data.prizeMessage,
            })
            setTimeout(() => {
              that.setData({
                modalHidden: false,
                zhongjiangtu: res.data.prizeMessage.STOCK_ID

              })
            }, 5500)
            const index_ = res.data.prizeMessage.PRIZE_ID;

            that.rotate(index_)
          }

        }
      })


      setTimeout(() => {
        that.data.flag = true
      }, 5500)


    }
  },

  // 转盘代码
  rotate: function (index_) {
    // rotate: function () {
    let _this = this;
    // let cat = 60;
    if (!this.data.turning) {
      let rdm = 0; //度数
      rdm = Math.floor(Math.random() * 3600); //最大10圈
      // rdm = 2100; //最大10圈
      //用索引的方法对应角度
      rdm = this.data.prizeList[index_ - 1]; //直接确定转的度数 
      // rdm =2200;//直接确定转的度数 
      animation.rotate(rdm).step();
      this.setData({
        rotate: animation.export(),
        turning: true
      });
      setTimeout(() => {
        this.setData({
          turning: false
        });
        let num = rdm % 360; //转了多少度
        //console.log(num);
        function showModal(str) {
          wx.showModal({
            title: '恭喜抽中',
            content: str,
            success: function () { //点击确定后还原到0度
              let animation = wx.createAnimation({
                duration: 100,
                timingFunction: 'ease-out'
              });
              animation.rotate(0).step();
              _this.setData({
                rotate: animation.export(),
                turning: false
              });
            },
            fail: function (res) {
              console.log(res)
            }
          })
        }

        if (rdm == 2200) {
          // showModal('谢谢惠顾');
          this.setData({
            modalHidden: true
          })
        } else if (rdm == 2100) {
          // showModal('一等奖');
          this.setData({
            modalHidden: true
          })
        } else if (rdm == 2330) {
          // showModal('三等奖');
          this.setData({
            modalHidden: true
          })
        } else if (rdm == 2610) {
          // showModal('参与奖');
          this.setData({
            modalHidden: true
          })
        } else if (rdm == 2400) {
          // showModal('二等奖');
          this.setData({
            modalHidden: true
          })
        }
      }, 4500)
    }
  },








  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(e) {

    this.setData({

      openid: app.globalData.openid,
      jiami: app.globalData.jiami,
      OPEN_ID: app.globalData.openid,
      session_key: app.globalData.session_key,
      CUSTOMER_ID: app.globalData.CUSTOMER_ID,

    });

    console.log(this.data.OPEN_ID);







  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {


    var that = this

    if (that.data.jiami == '' || that.data.session_key == '') {

      wx.login({
        success: function (res) {
          console.log(res);
          if (res.code) { //wx.login获取code。
            console.log(res.code);
            //发起网络请求

            wx.request({
              url: app.globalData.interface+'/post/API_1062_appGetOpenid',
              // url: 'http://192.168.3.173:8081/post/API_1062_appGetOpenid',
              method: 'GET',
              //向后端发送的数据
              data: {
                code: res.code //将code发送到后台服务器。
              },
              header: {
                "Content-Type": "application/x-www-form-urlencoded" //POST方式是这个
              },
              success: res => {
                console.log(res);
                if (res.data.result != 'success') {
                  console.log(1);

                } else {
                  var openid = res.data.openid;
                  app.globalData.openid = openid;

                  console.log(res.data.openid);
                  that.setData({
                    openid: res.data.openid
                  })
                  // that.scanCod()

                  that.setData({
                    phone: app.globalData.phone,
                    CUSTOMER_ID: app.globalData.CUSTOMER_ID,
                    jiami: app.globalData.jiami,
                    OPEN_ID: app.globalData.openid,
                    openid: app.globalData.openid,
                    session_key: app.globalData.session_key,
                  })
                  console.log(that.data.phone);
                  console.log(that.data.jiami);
                  console.log(that.data.openid);
                  console.log(that.data.session_key);



                  // that.chaxunshifouli()

                }

              }
            })
          } else {
            console.log('获取用户登录态失败！' + res.errMsg)
          }
        }
      });
    } else {

      console.log('成功');
    }




    // that.chaxunshifouli()
    that.region()



  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {


  },



})